-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New json export #537
base: main
Are you sure you want to change the base?
New json export #537
Conversation
✅ Deploy Preview for 3dstreet-core-builds ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…d implementation around for testing and comparison
647254f
to
079d94d
Compare
The previous export also doesn't round the vec3, we can get |
Other differences between the two implementations. 3dstreet/src/json-utils_1.1.js Lines 108 to 111 in afb7aa2
and the loader read it here 3dstreet/src/json-utils_1.1.js Lines 412 to 423 in afb7aa2
not sure why we have that delete entityData.components[attr]; line here.
example of exported json {
"element": "a-entity",
"mixin": "markings solid-stripe",
"primitive": "plane",
"components": {
"geometry": "buffer: false; skipCache: true; width: 0.2; height: 150",
"material": "repeat: 1 5; transparent: true; src: #markings-atlas",
"scale": "1 0.4 1",
"rotation": "270 0 0",
"position": "0 0.01 0"
}
} There is no primitive prop in geometry component, I'm not sure if this is deleted explicitly in the code, I didn't found that. Another difference is the exported class is an array. |
old implementation has a way to remove some properties inside a component 3dstreet/src/json-utils_1.1.js Lines 175 to 184 in afb7aa2
|
This reverts commit 7e7a576.
…zeComponents so that applies to both json and html export
Main differences between the previous implementation and the new implementation:
Previous implementation has its own
toPropString
function that does its own thing and usingAFRAME.utils.coordinates.stringify(propData)
only for vectors instead of usingstringifyComponentValue
from entity.js that usesschema.stringify
that have the implementation of stringify for each property types.In the new export I'm doing the filters early while doing
prepareForSerialization
, that's cloning the entity (but not attached to the DOM) and then callremoveAttribute
if needed.In previous implementation, it's iterating over the existing DOM, serialize each component with the "not include default values logic" that exists in entity.js but functions were copied from entity.js (not sure if there are some changes to those), and do a filter afterwards on the json with
filterJSONstreet
.